package com.dys.databindingstudy.bean;

import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;

import com.dys.databindingstudy.BR;

/**
 * 账号信息
 */
public class Account extends BaseObservable {

    /**
     * 账号名称
     */
    private String name;

    /**
     * 账号等级
     */
    private int level;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    // 等级发生变化自动更新视图
    @Bindable
    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
        // 更新视图 BR跟R相似
        notifyPropertyChanged(BR.level);
    }
}
